<?php
$this->Paginator->options(array(
    'url' => $usersTableURL,
    'update' => '.users.table',
    'evalScripts' => true
));?>
<table class="table table-striped">
<tr>
	<th>#No.</th>
	<th><?php echo $this->Paginator->sort('fullname', __d('admin', 'fullname'), array('model' => $usersTableModelAlias));?></th>
	<th><?php echo $this->Paginator->sort('phone', __d('admin', 'phone'), array('model' => $usersTableModelAlias));?></th>
	<th><?php echo $this->Paginator->sort('created_date', __d('admin', 'created_date'), array('model' => $usersTableModelAlias));?></th>
    <th class="actions"><?php echo __d('admin', 'Actions');?></th>
</tr>
<?php
foreach ($users as $key=>$user): 
$currentPage = $this->Paginator->counter('{:page}');
$num = (($currentPage - 1) * 15) + ($key+1);
?>
	<tr>
		<td><?php echo $num; ?>&nbsp;</td>
		<td><?php echo h($user[$usersTableModelAlias]['fullname']); ?>&nbsp;</td>
		<td><?php echo h($user[$usersTableModelAlias]['phone']); ?>&nbsp;</td>
		<td><?php echo h($user[$usersTableModelAlias]['created_date']); ?>&nbsp;</td>
		<td class="actions">
		<?php if($user[$usersTableModelAlias]['is_login']) :?>
			<?php echo $this->Html->link(__d('admin', 'Logout'), array('plugin' => 'admin', 'controller' => 'admin_users', 'action' => 'goout', $user[$usersTableModelAlias]['user_id'], '?' => array('redirect' => $redirectUrl)), array('class' => 'btn btn-success btn-xs')); ?>
		<?php endif;?>
			<?php echo $this->Html->link(__d('admin', 'Edit'), array('plugin' => 'admin', 'controller' => 'admin_users', 'action' => 'edit', $user[$usersTableModelAlias]['user_id'], '?' => array('redirect' => $redirectUrl)), array('class' => 'btn btn-info btn-xs')); ?>
			<?php echo $this->Form->postLink(__d('admin', 'Delete'), array('plugin' => 'admin', 'controller' => 'admin_users', 'action' => 'delete', $user[$usersTableModelAlias]['user_id'], '?' => array('redirect' => $redirectUrl)), array('class' => 'btn btn-danger btn-xs'), __d('admin', 'Are you sure you want to delete # %s?', $user[$usersTableModelAlias]['user_id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
</table>
<div class="text-success"><?php echo $this->Paginator->counter('Total {:count} registration users');?></div>
<?php if($this->Paginator->counter('{:pages}') > 1) :?>
<div>
    <ul class="pagination">
<?php
		echo '<li>' . $this->Paginator->prev('Prev', array('model' => $usersTableModelAlias), null, array('class' => 'prev disabled')) . '</li>';
		echo $this->Paginator->numbers(array('separator' => '', 'tag' => 'li', 'currentTag' => 'span', 'currentClass' => 'active', 'model' => $usersTableModelAlias));
		echo '<li>' . $this->Paginator->next('Next', array('model' => $usersTableModelAlias), null, array('class' => 'next disabled')) . '</li>';
	?>
    </ul>
</div>
<?php endif;?>

<?php
      echo $this->Js->writeBuffer();